package com.sgb.kjwl.view.ui.activity;

import androidx.databinding.DataBindingUtil;
import android.os.Bundle;
import android.view.View;

import com.sgb.kjwl.AppActivity;
import com.sgb.kjwl.R;
import com.sgb.kjwl.databinding.ActivityDaggerTestBinding;
import com.sgb.kjwl.di.DaggerDraggerTestComponent;
import com.sgb.kjwl.di.DraggerTestModule;
import com.sgb.kjwl.viewmodel.DraggerTestModel;
import com.swgk.core.base.di.AppComponent;
import com.swgk.core.util.MToast;

import javax.inject.Inject;

public class DaggerTestActivity extends AppActivity {
    private ActivityDaggerTestBinding binding;
    @Inject
    DraggerTestModel viewModel;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    protected void setupActivityComponent(AppComponent appComponent) {
        DaggerDraggerTestComponent.builder().appComponent(appComponent).draggerTestModule(new DraggerTestModule(this)).build().inject(this);
    }

    @Override
    protected void initView() {
        binding = DataBindingUtil.setContentView(this, R.layout.activity_dagger_test);
        binding.rlTest.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                viewModel.testShow("测试一下下");
            }
        });
    }

    @Override
    protected void init() {


    }

    public void showText(String text){
        MToast.showToast(this, text);
    }
}
